package hu.mapper;

import com.github.pagehelper.Page;
import hu.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

//持久层和数据库交互
@Mapper//将接口生成动态代理类
public interface UserMapper {

//    简单sql语句用注解解决
    //根据账户名和密码查找用户并返回
    @Select("select * from employee where account = #{account} and password = #{password}")
    User getByAccountAndPassword(User user);

    //更改工资
    @Update("update employee set money = #{money},update_time = #{updateTime} where username= #{username}")
    void update(User user);

//    复杂sql语句在xml文件里解决
    //用户查询(显示)
    List<User> page(String username, Integer moneyBegin, Integer moneyEnd);
}
